//
//  ZGLPicCell.m
//  Faker
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "ZGLPicCell.h"
#import "ZGLPicVCModel.h"
#import <UIImageView+AFNetworking.h>

@interface ZGLPicCell ()

@property (nonatomic, strong) UIImageView *bigImage;
@property (nonatomic, strong) UILabel *wordLabel;

@end


@implementation ZGLPicCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _bigImage = [[UIImageView alloc] init];
        _wordLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_bigImage];
        [self.contentView addSubview:_wordLabel];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.backgroundColor = foreColor;
    [_bigImage setFrame:CGRectMake(ScaleX * 5, ScaleY * 5, ScaleX * 365, ScaleY * 142.5)];
    [_wordLabel setFrame:CGRectMake(ScaleX * 20, ScaleY * 100, ScaleX * 320, ScaleY * 40)];
    _wordLabel.numberOfLines = 2;
    _wordLabel.textColor = [UIColor whiteColor];
    _wordLabel.font = [UIFont systemFontOfSize:13];
    _wordLabel.shadowColor =[UIColor blackColor];
    _wordLabel.shadowOffset = CGSizeMake(0.3, 0.3);
}

- (void)setPicModel:(ZGLPicVCModel *)picModel {
    if (_picModel != picModel) {
        _picModel = picModel;
    }
    [_bigImage setImageWithURL:[NSURL URLWithString:picModel.media[0][@"s_url"]] placeholderImage:[UIImage imageNamed:@"nopic"]];
    _wordLabel.text = picModel.title;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
